# roles/prometheus/templates/prometheus.service.j2
[Unit]
Description=Prometheus Monitoring
Wants=network-online.target
After=network-online.target

[Service]
User={{ prometheus_user }}
Group={{ prometheus_group }}
Type=simple
ExecStart=/usr/local/bin/prometheus \
    --config.file={{ prometheus_config_dir }}/prometheus.yml \
    --storage.tsdb.path={{ prometheus_data_dir }} \
    --web.listen-address={{ prometheus_web_listen_address }} \
{% if prometheus_web_external_url %}    --web.external-url={{ prometheus_web_external_url }} \
{% endif %}    --web.enable-lifecycle
Restart=on-failure

[Install]
WantedBy=multi-user.target